package ngamejava2.objects;

import java.awt.Color;
import java.awt.Graphics2D;
import ngamejava2.GameObject;
import ngamejava2.GamePlane;

public class PlataformaSobeEDesce extends GameObject<GamePlane>
{
	private int anchor;
	private int dir;

	public PlataformaSobeEDesce()
	{
		super();
		setCollidable(true);
		getBounds().width = 100;
		getBounds().height = 20;
		getBounds().x = 400;
		getBounds().y = 400;
		anchor = 400;
		dir = 1;
	}

	@Override
	public void update(long currentTick)
	{
		getBounds().y += dir;
		if (getBounds().y > anchor+300 || getBounds().y < anchor-300)
		{
			dir *= -1;
		}
	}

	@Override
	public void render(Graphics2D g, long currentFrame)
	{
		g.setColor(Color.yellow);
		g.fill(getBounds());
	}
}